package com.linkedbear.springboot.assemble.d_spi;

import com.linkedbear.springboot.assemble.d_spi.bean.DemoDao;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.core.io.support.SpringFactoriesLoader;

import java.util.List;
//@SpringBootApplication
public class SpringSpiApplication {
    public static void main(String[] args) {
        List<DemoDao> demoDaos = SpringFactoriesLoader.loadFactories(DemoDao.class, SpringSpiApplication.class.getClassLoader());

        demoDaos.forEach(dao -> System.out.println(dao)); // 打印对象
        System.out.println("===========================================");

        List<String> daoClassNames = SpringFactoriesLoader.loadFactoryNames(DemoDao.class, SpringSpiApplication.class.getClassLoader()); // 全限定名

        daoClassNames.forEach(className -> System.out.println(className));
    }
}
